#include<bits/stdc++.h>
#define Max 100205
#define ll long long
using namespace std;
ll d[3][Max], a[Max], b[Max], c[Max];
ll n;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	freopen("summer.in", "r", stdin);
	freopen("summer.out", "w", stdout);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 1; i <= n; i++) {
		d[0][i] = max(d[1][i - 1], d[2][i - 1]) + a[i];
		d[1][i] = max(d[0][i - 1], d[2][i - 1]) + b[i];
		d[2][i] = max(d[0][i - 1], d[1][i - 1]) + c[i];
	}
	cout << max(d[0][n], max(d[1][n], d[2][n]));
	return 0;
}
